<?php
	require_once 'Shape.php';
	
	
	class Triangle extends Shape {
		
		private $c;
		
		public function  __construct($a, $b, $c) {
			if ( $a + $b > $c && $c > 0 ) {
				parent::__construct($a, $b);
				$this->c = $c;
				$this->shapeType = "Triangle";
			}
		}
		
		public function printInfo() {
			echo "This shape is " . $this->getShapeType() . "
				  and has sides : a = " . $this->width . " and b = " . $this->height ."
				  and c = " . $this->c . "<br/>";
		}
		
		public function  getArea() {
			$p = ($this->width+$this->height+$this->c)/2;
			
			return sqrt($p*($p-$this->width) * ($p-$this->height) * ($p-$this->c));
		}
		
		public function resize($newA, $newB, $newC=0) {
			$this->c = $newC;
			parent::resize($newA, $newB); 
		}
		
		public function getPerimeter() {
			return ($this->width+$this->height+$this->c);
		}
		
	}
	
	$triangle = new Triangle(10,25,30);
	
	$triangle->resize(20,30,30);
	
	echo $triangle->getArea() . " <br/>";
	echo $triangle->getPerimeter();
	
// 	$triangle->width = 100;
	//echo $triangle->fgfdgfdgfd;
	$triangle->printInfo();
?>